package com.ruoyi.app.util;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class CouponUsageLimitUtil {

    public static boolean checkUsageLimit(String usageLimit, Integer usageLimitValue, Integer userInstanceUsedCount, Integer todayInstanceUsedCount, Integer todayUserInstanceUsedCount) {
        switch (usageLimit) {
            case "PER_USER":
                return usageLimitValue > userInstanceUsedCount;
            case "PER_DAY":
                return usageLimitValue > todayInstanceUsedCount;
            case "PER_USER_PER_DAY":
                return usageLimitValue > todayUserInstanceUsedCount;
            default:
                return false;
        }
    }

}
